<?
/**
 * 图片验证码生成功能
 * 
 * @copyright Copyright (c) 2008 sdmblog (http://www.sdmblog.cn)
 * @author sdomain(sdomain@live.cn)
 * @version imgcode.php Sat May 17 17:12:38 CST 2008 php $
 */
if ($_GET["id"]=='1')
{
Header("Content-type:image/PNG"); 
header('Cache-Control: no-cache, must-revalidate');
session_start(); 

$auth_num=""; 

//session_destroy();
session_unregister('auth_num'); 
session_register('auth_num'); 
srand((double)microtime()*10000000); 
$auth_num_k=rand(999999999,99999999999999999); 
$auth_num=substr($auth_num_k,2,5); //！！

//$black=ImageColorAllocate($im,0,0,0); 
$im=imagecreate(45,16); 

$white=ImageColorAllocate($im,255,255,255); 

$black=ImageColorAllocate($im,0,0,0); 
$gray=ImageColorAllocate($im,200,200,200); 
$gray=ImageColorAllocate($im,217,222,1); 


imagestring($im,5,1,1,$auth_num,$black); 

//画点
for($i=0;$i<200;$i++) 

{ 
	$randcolor=ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255)); 
	imagesetpixel($im,rand()%70,rand()%30,$randcolor); 
} 

ImagePNG($im); 
ImageDestroy($im); 
}
?>